import { createRouter, createWebHashHistory, RouteRecordRaw,RouteMeta } from 'vue-router'
import Home from '../views/Home.vue'
import Login from '../views/Login.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/Home',
    name: 'Home',
    component: Home,
    meta: {
      isShow: false
    },
    children:[
      {
        path: '/courseList',
        name: 'CourseList',
        component: () => import(/* webpackChunkName: "courseList" */ '../views/courseList.vue'),
        meta:{
          isShow: true,
          title: "课程列表"
        }
      },
      {
        path: '/teacherList',
        name: 'TeacherList',
        component: () => import(/* webpackChunkName: "teacherList" */ '../views/teacherList.vue'),
        meta:{
          isShow: true,
          title: "教师列表"
        }
      },
      {
        path: '/personal',
        name: 'Personal',
        component: () => import(/* webpackChunkName: "personal" */ '../views/personal.vue'),
        meta:{
          isShow: true,
          title: "个人中心"
        }
      }
    ]
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue'),
    meta:{
      isShow: false
    }
  },
  {
    path: '/',
    name: 'Login',
    component: Login,
    meta:{
      isShow: false
    }
  },
  
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
